home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / gnu / diff_2_1.lha / diff-2.1 / diff.info-3 (.txt) < prev    next >
GNU Info File  |  1993-02-02  |  46KB  |  897 lines

  1. This is Info file diff.info, produced by Makeinfo-1.51 from the input
  2. file ./diff.texi.
  3.    This file documents the the GNU `diff', `diff3', `sdiff', and `cmp'
  4. commands for showing the differences between text files and the `patch'
  5. command for using their output to update files.
  6.    Copyright (C) 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided that
  12. the entire resulting derived work is distributed under the terms of a
  13. permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that this permission notice may be stated in a
  17. translation approved by the Foundation.
  18. File: diff.info,  Node: diff Options,  Up: Invoking diff
  19. Options to `diff'
  20. =================
  21.    Below is a summary of all of the options that GNU `diff' accepts.
  22. Most options have two equivalent names, one of which is a single letter
  23. preceded by `-', and the other of which is a long name preceded by
  24. `--'.  Multiple single letter options (unless they take an argument)
  25. can be combined into a single command line word: `-ac' is equivalent to
  26. `-a -c'.  Long named options can be abbreviated to any unique prefix of
  27. their name.  Brackets ([ and ]) indicate that an option takes an
  28. optional argument.
  29. `-LINES'
  30.      Show LINES (an integer) lines of context.  This option does not
  31.      specify an output format by itself; it has no effect unless it is
  32.      combined with `-c' (*note Context Format::.) or `-u' (*note
  33.      Unified Format::.).  This option is obsolete.
  34.      Treat all files as text and compare them line-by-line, even if they
  35.      do not seem to be text.  *Note Binary::.
  36.      Ignore changes in amount of blank and tab whitespace.  *Note
  37.      Whitespace::.
  38.      Ignore changes that just insert or delete blank lines.  *Note
  39.      Blank Lines::.
  40. `--brief'
  41.      Report only whether the files differ, not the details of the
  42.      differences.  *Note Brief::.
  43.      Use the context output format.  *Note Context Format::.
  44. `-C LINES'
  45. `--context[=LINES]'
  46.      Use the context output format, showing LINES (an integer) lines of
  47.      context, or three if LINES is not given.  *Note Context Format::.
  48. `--changed-group-format=FORMAT'
  49.      Use FORMAT to output a line group containing differing lines from
  50.      both files in if-then-else format.  *Note Line Group Formats::.
  51.      Change the algorithm perhaps find a smaller set of changes.  This
  52.      makes `diff' slower (sometimes much slower).  *Note diff
  53.      Performance::.
  54. `-D NAME'
  55.      Make merged `#ifdef' format output, conditional on the preprocessor
  56.      macro NAME.  *Note If-then-else::.
  57. `--ed'
  58.      Make output that is a valid `ed' script.  *Note ed Scripts::.
  59. `--exclude=PATTERN'
  60.      When comparing directories, ignore files and subdirectories whose
  61.      basenames match PATTERN.  *Note Comparing Directories::.
  62. `--exclude-from=FILE'
  63.      When comparing directories, ignore files and subdirectories whose
  64.      basenames match any pattern contained in FILE.  *Note Comparing
  65.      Directories::.
  66. `--expand-tabs'
  67.      Expand tabs to spaces in the output, to preserve the alignment of
  68.      tabs in the input files.  *Note Tabs::.
  69.      Make output that looks vaguely like an `ed' script but has changes
  70.      in the order they appear in the file.  *Note Forward ed::.
  71. `-F REGEXP'
  72.      In context and unified format, for each hunk of differences, show
  73.      some of the last preceding line that matches REGEXP.  *Note
  74.      Specified Headings::.
  75. `--forward-ed'
  76.      Make output that looks vaguely like an `ed' script but has changes
  77.      in the order they appear in the file.  *Note Forward ed::.
  78.      This option currently has no effect; it is present for Unix
  79.      compatibility.
  80.      Use heuristics to speed handling of large files that have numerous
  81.      scattered small changes.  *Note diff Performance::.
  82.      Ignore changes in case; consider upper- and lower-case letters
  83.      equivalent.  *Note Case Folding::.
  84. `-I REGEXP'
  85.      Ignore changes that just insert or delete lines that match REGEXP.
  86.      *Note Specified Folding::.
  87. `--ifdef=NAME'
  88.      Make merged if-then-else output using FORMAT.  *Note
  89.      If-then-else::.
  90. `--ignore-all-space'
  91.      Ignore whitespace when comparing lines.  *Note Whitespace::.
  92. `--ignore-blank-lines'
  93.      Ignore changes that just insert or delete blank lines.  *Note
  94.      Blank Lines::.
  95. `--ignore-case'
  96.      Ignore changes in case; consider upper- and lower-case to be the
  97.      same.  *Note Case Folding::.
  98. `--ignore-matching-lines=REGEXP'
  99.      Ignore changes that just insert or delete lines that match REGEXP.
  100.      *Note Specified Folding::.
  101. `--ignore-space-change'
  102.      Ignore changes in amount of blank and tab whitespace.  *Note
  103.      Whitespace::.
  104. `--initial-tab'
  105.      Output a tab rather than a space before the text of a line in
  106.      normal or context format.  This causes the alignment of tabs in
  107.      the line to look normal.  *Note Tabs::.
  108.      Pass the output through `pr' to paginate it.  *Note Pagination::.
  109. `-L LABEL'
  110.      Use LABEL instead of the file name in the context format (*note
  111.      Context Format::.) and unified format (*note Unified Format::.)
  112.      headers.  *Note RCS::.
  113. `--label=LABEL'
  114.      Use LABEL instead of the file name in the context format (*note
  115.      Context Format::.) and unified format (*note Unified Format::.)
  116.      headers.
  117. `--left-column'
  118.      Print only the left column of two common lines in side by side
  119.      format.  *Note Side by Side Format::.
  120. `--minimal'
  121.      Change the algorithm to perhaps find a smaller set of changes.
  122.      This makes `diff' slower (sometimes much slower).  *Note diff
  123.      Performance::.
  124.      Output RCS-format diffs; like `-f' except that each command
  125.      specifies the number of lines affected.  *Note RCS::.
  126. `--new-file'
  127.      In directory comparison, if a file is found in only one directory,
  128.      treat it as present but empty in the other directory.  *Note
  129.      Comparing Directories::.
  130. `--new-group-format=FORMAT'
  131.      Use FORMAT to output a group of lines taken from just the second
  132.      file in if-then-else format.  *Note Line Group Formats::.
  133. `--new-line-format=FORMAT'
  134.      Use FORMAT to output a line taken from just the second file in
  135.      if-then-else format.  *Note Line Formats::.
  136. `--old-group-format=FORMAT'
  137.      Use FORMAT to output a group of lines taken from just the first
  138.      file in if-then-else format.  *Note Line Group Formats::.
  139. `--old-line-format=FORMAT'
  140.      Use FORMAT to output a line taken from just the first file in
  141.      if-then-else format.  *Note Line Formats::.
  142.      Show which C function each change is in.  *Note C Function
  143.      Headings::.
  144.      When comparing directories, if a file appears only in the second
  145.      directory of the two, treat it as present but empty in the other.
  146. `--paginate'
  147.      Pass the output through `pr' to paginate it.  *Note Pagination::.
  148.      Report only whether the files differ, not the details of the
  149.      differences.  *Note Brief::.
  150.      When comparing directories, recursively compare any subdirectories
  151.      found.  *Note Comparing Directories::.
  152. `--rcs'
  153.      Output RCS-format diffs; like `-f' except that each command
  154.      specifies the number of lines affected.  *Note RCS::.
  155. `--recursive'
  156.      When comparing directories, recursively compare any subdirectories
  157.      found.  *Note Comparing Directories::.
  158. `--report-identical-files'
  159.      Report when two files are the same.  *Note Comparing Directories::.
  160.      Report when two files are the same.  *Note Comparing Directories::.
  161. `-S FILE'
  162.      When comparing directories, start with the file FILE.  This is
  163.      used for resuming an aborted comparison.  *Note Comparing
  164.      Directories::.
  165. `--sdiff-merge-assist'
  166.      Print extra information to help `sdiff'.  `sdiff' uses this option
  167.      when it runs `diff'.  This option is not intended for users to use
  168.      directly.
  169. `--show-c-function'
  170.      Show which C function each change is in.  *Note C Function
  171.      Headings::.
  172. `--show-function-line=REGEXP'
  173.      In context and unified format, for each hunk of differences, show
  174.      some of the last preceding line that matches REGEXP.  *Note
  175.      Specified Headings::.
  176. `--side-by-side'
  177.      Use the side by side output format.  *Note Side by Side Format::.
  178. `--speed-large-files'
  179.      Use heuristics to speed handling of large files that have numerous
  180.      scattered small changes.  *Note diff Performance::.
  181. `--starting-file=FILE'
  182.      When comparing directories, start with the file FILE.  This is
  183.      used for resuming an aborted comparison.  *Note Comparing
  184.      Directories::.
  185. `--suppress-common-lines'
  186.      Do not print common lines in side by side format.  *Note Side by
  187.      Side Format::.
  188.      Expand tabs to spaces in the output, to preserve the alignment of
  189.      tabs in the input files.  *Note Tabs::.
  190.      Output a tab rather than a space before the text of a line in
  191.      normal or context format.  This causes the alignment of tabs in
  192.      the line to look normal.  *Note Tabs::.
  193. `--text'
  194.      Treat all files as text and compare them line-by-line, even if they
  195.      do not appear to be text.  *Note Binary::.
  196.      Use the unified output format.  *Note Unified Format::.
  197. `--unchanged-group-format=FORMAT'
  198.      Use FORMAT to output a group of common lines taken from both files
  199.      in if-then-else format.  *Note Line Group Formats::.
  200. `--unchanged-line-format=FORMAT'
  201.      Use FORMAT to output a line common to both files in if-then-else
  202.      format.  *Note Line Formats::.
  203. `--unidirectional-new-file'
  204.      When comparing directories, if a file appears only in the second
  205.      directory of the two, treat it as present but empty in the other.
  206.      *Note Comparing Directories::.
  207. `-U LINES'
  208. `--unified[=LINES]'
  209.      Use the unified output format, showing LINES (an integer) lines of
  210.      context, or three if LINES is not given.  *Note Unified Format::.
  211. `--version'
  212.      Output the version number of `diff'.
  213.      Ignore horizontal whitespace when comparing lines.  *Note
  214.      Whitespace::.
  215. `-W COLUMNS'
  216. `--width=COLUMNS'
  217.      Use an output width of COLUMNS in side by side format.  *Note Side
  218.      by Side Format::.
  219. `-x PATTERN'
  220.      When comparing directories, ignore files and subdirectories whose
  221.      basenames match PATTERN.  *Note Comparing Directories::.
  222. `-X FILE'
  223.      When comparing directories, ignore files and subdirectories whose
  224.      basenames match any pattern contained in FILE.  *Note Comparing
  225.      Directories::.
  226.      Use the side by side output format.  *Note Side by Side Format::.
  227. File: diff.info,  Node: Invoking diff3,  Next: Invoking patch,  Prev: Invoking diff,  Up: Top
  228. Invoking `diff3'
  229. ****************
  230.    The `diff3' command compares three files and outputs descriptions of
  231. their differences.  Its arguments are as follows:
  232.      diff3 OPTIONS... MINE OLDER YOURS
  233.    The files to compare are MINE, OLDER, and YOURS.  At most one of
  234. these three file names may be `-', which tells `diff3' to read the
  235. standard input for that file.
  236.    An exit status of 0 means `diff3' was successful, 1 means some
  237. conflicts were found, and 2 means trouble.
  238. * Menu:
  239. * diff3 Options::        Summary of options to `diff3'.
  240. File: diff.info,  Node: diff3 Options,  Up: Invoking diff3
  241. Options to `diff3'
  242. ==================
  243.    Below is a summary of all of the options that GNU `diff3' accepts.
  244. Multiple single letter options (unless they take an argument) can be
  245. combined into a single command line argument.
  246.      Treat all files as text and compare them line-by-line, even if they
  247.      do not appear to be text.  *Note Binary::.
  248.      Incorporate all changes from OLDER to YOURS into MINE, surrounding
  249.      all conflicts with bracket lines.  *Note Marking Conflicts::.
  250.      Generate an `ed' script that incorporates all the changes from
  251.      OLDER to YOURS into MINE.  *Note Which Changes::.
  252.      Like `-e', except bracket lines from overlapping changes' first
  253.      and third files.  *Note Marking Conflicts::.  With `-e', an
  254.      overlapping change looks like this:
  255.           <<<<<<< MINE
  256.           lines from MINE
  257.           =======
  258.           lines from YOURS
  259.           >>>>>>> YOURS
  260. `--ed'
  261.      Generate an `ed' script that incorporates all the changes from
  262.      OLDER to YOURS into MINE.  *Note Which Changes::.
  263. `--easy-only'
  264.      Like `-e', except output only the nonoverlapping changes.  *Note
  265.      Which Changes::.
  266.      Generate `w' and `q' commands at the end of the `ed' script for
  267.      System V compatibility.  This option must be combined with one of
  268.      the `-AeExX3' options, and may not be combined with `-m'.  *Note
  269.      Saving the Changed File::.
  270. `-L LABEL'
  271. `--label=LABEL'
  272.      Use the label LABEL for the brackets output by the `-A', `-E' and
  273.      `-X' options.  This option may be given up to three times, one for
  274.      each input file.  The default labels are the names of the input
  275.      files.  Thus `diff3 -L X -L Y -L Z -m A B C' acts like `diff3 -m A
  276.      B C', except that the output looks like it came from files named
  277.      `X', `Y' and `Z' rather than from files named `A', `B' and `C'.
  278.      *Note Marking Conflicts::.
  279. `--merge'
  280.      Apply the edit script to the first file and send the result to
  281.      standard output.  Unlike piping the output from `diff3' to `ed',
  282.      this works even for binary files and incomplete lines.  `-A' is
  283.      assumed if no edit script option is specified.  *Note Bypassing
  284.      ed::.
  285. `--overlap-only'
  286.      Like `-e', except output only the overlapping changes.  *Note
  287.      Which Changes::.
  288. `--show-all'
  289.      Incorporate all unmerged changes from OLDER to YOURS into MINE,
  290.      surrounding all overlapping changes with bracket lines.  *Note
  291.      Marking Conflicts::.
  292. `--show-overlap'
  293.      Like `-e', except bracket lines from overlapping changes' first
  294.      and third files.  *Note Marking Conflicts::.
  295. `--text'
  296.      Treat all files as text and compare them line-by-line, even if they
  297.      do not appear to be text.  *Note Binary::.
  298. `--version'
  299.      Output the version number of `diff3'.
  300.      Like `-e', except output only the overlapping changes.  *Note
  301.      Which Changes::.
  302.      Like `-E', except output only the overlapping changes.  In other
  303.      words, like `-x', except bracket changes as in `-E'.  *Note
  304.      Marking Conflicts::.
  305.      Like `-e', except output only the nonoverlapping changes.  *Note
  306.      Which Changes::.
  307. File: diff.info,  Node: Invoking patch,  Next: Invoking sdiff,  Prev: Invoking diff3,  Up: Top
  308. Invoking `patch'
  309. ****************
  310.    Normally `patch' is invoked like this:
  311.      patch <PATCHFILE
  312.    The full format for invoking `patch' is:
  313.      patch OPTIONS... [ORIGFILE [PATCHFILE]] [+ OPTIONS... [ORIGFILE]]...
  314.    If you do not specify PATCHFILE, or if PATCHFILE is `-', `patch'
  315. reads the patch (that is, the `diff' output) from the standard input.
  316.    You can specify one or more of the original files as ORIG arguments;
  317. each one and options for interpreting it is separated from the others
  318. with a `+'.  *Note Multiple Patches::, for more information.
  319.    If you do not specify an input file on the command line, `patch'
  320. tries to figure out from the "leading text" (any text in the patch that
  321. comes before the `diff' output) which file to edit.  In the header of a
  322. context or unified diff, `patch' looks in lines beginning with `***',
  323. `---', or `+++'; among those, it chooses the shortest name of an
  324. existing file.  Otherwise, if there is an `Index:' line in the leading
  325. text, `patch' tries to use the file name from that line.  If `patch'
  326. cannot figure out the name of an existing file from the leading text,
  327. it prompts you for the name of the file to patch.
  328.    If the input file does not exist or is read-only, and a suitable RCS
  329. or SCCS file exists, `patch' attempts to check out or get the file
  330. before proceeding.
  331.    By default, `patch' replaces the original input file with the
  332. patched version, after renaming the original file into a backup file
  333. (*note Backups::., for a description of how `patch' names backup
  334. files).  You can also specify where to put the output with the `-o
  335. OUTPUT-FILE' or `--output=OUTPUT-FILE' option.
  336. * Menu:
  337. * patch Directories::    Changing directory and stripping paths.
  338. * Backups::        Backup file names.
  339. * Rejects::        Reject file names.
  340. * patch Options::    Summary table of options to `patch'.
  341. File: diff.info,  Node: patch Directories,  Next: Backups,  Up: Invoking patch
  342. Applying Patches in Other Directories
  343. =====================================
  344.    The `-d DIRECTORY' or `--directory=DIRECTORY' option to `patch'
  345. makes directory DIRECTORY the current directory for interpreting both
  346. file names in the patch file, and file names given as arguments to
  347. other options (such as `-B' and `-o').  For example, while in a news
  348. reading program, you can patch a file in the `/usr/src/emacs' directory
  349. directly from the article containing the patch like this:
  350.      | patch -d /usr/src/emacs
  351.    Sometimes the file names given in a patch contain leading
  352. directories, but you keep your files in a directory different from the
  353. one given in the patch.  In those cases, you can use the `-p[NUMBER]'
  354. or `--strip[=NUMBER]' option to set the file name strip count to
  355. NUMBER.  The strip count tells `patch' how many slashes, along with the
  356. directory names between them, to strip from the front of file names.
  357. `-p' with no NUMBER given is equivalent to `-p0'.  By default, `patch'
  358. strips off all leading paths, leaving just the base file names, except
  359. that when a file name given in the patch is a relative path and all of
  360. its leading directories already exist, `patch' does not strip off the
  361. leading path.  (A "relative" path is one that does not start with a
  362. slash.)
  363.    `patch' looks for each file (after any slashes have been stripped)
  364. in the current directory, or if you used the `-d DIRECTORY' option, in
  365. that directory.
  366.    For example, suppose the file name in the patch file is
  367. `/gnu/src/emacs/etc/NEWS'.  Using `-p' or `-p0' gives the entire file
  368. name unmodified, `-p1' gives `gnu/src/emacs/etc/NEWS' (no leading
  369. slash), `-p4' gives `etc/NEWS', and not specifying `-p' at all gives
  370. `NEWS'.
  371. File: diff.info,  Node: Backups,  Next: Rejects,  Prev: patch Directories,  Up: Invoking patch
  372. Backup File Names
  373. =================
  374.    Normally, `patch' renames an original input file into a backup file
  375. by appending to its name the extension `.orig', or `~' on systems that
  376. do not support long file names.  The `-b BACKUP-SUFFIX' or
  377. `--suffix=BACKUP-SUFFIX' option uses BACKUP-SUFFIX as the backup
  378. extension instead.
  379.    Alternately, you can specify the extension for backup files with the
  380. `SIMPLE_BACKUP_SUFFIX' environment variable, which the options override.
  381.    `patch' can also create numbered backup files the way GNU Emacs
  382. does.  With this method, instead of having a single backup of each file,
  383. `patch' makes a new backup file name each time it patches a file.  For
  384. example, the backups of a file named `sink' would be called,
  385. successively, `sink.~1~', `sink.~2~', `sink.~3~', etc.
  386.    The `-V BACKUP-STYLE' or `--version-control=BACKUP-STYLE' option
  387. takes as an argument a method for creating backup file names.  You can
  388. alternately control the type of backups that `patch' makes with the
  389. `VERSION_CONTROL' environment variable, which the `-V' option
  390. overrides.  The value of the `VERSION_CONTROL' environment variable and
  391. the argument to the `-V' option are like the GNU Emacs
  392. `version-control' variable (*note emacs: Backups., for more information
  393. on backup versions in Emacs).  They also recognize synonyms that are
  394. more descriptive.  The valid values are listed below; unique
  395. abbreviations are acceptable.
  396. `numbered'
  397.      Always make numbered backups.
  398. `nil'
  399. `existing'
  400.      Make numbered backups of files that already have them, simple
  401.      backups of the others.  This is the default.
  402. `never'
  403. `simple'
  404.      Always make simple backups.
  405.    Alternately, you can tell `patch' to prepend a prefix, such as a
  406. directory name, to produce backup file names.  The `-B BACKUP-PREFIX'
  407. or `--prefix=BACKUP-PREFIX' option makes backup files by prepending
  408. BACKUP-PREFIX to them.  If you use this option, `patch' ignores any
  409. `-b' option that you give.
  410.    If the backup file already exists, `patch' creates a new backup file
  411. name by changing the first lowercase letter in the last component of
  412. the file name into uppercase.  If there are no more lowercase letters
  413. in the name, it removes the first character from the name.  It repeats
  414. this process until it comes up with a backup file name that does not
  415. already exist.
  416.    If you specify the output file with the `-o' option, that file is
  417. the one that is backed up, not the input file.
  418. File: diff.info,  Node: Rejects,  Next: patch Options,  Prev: Backups,  Up: Invoking patch
  419. Reject File Names
  420. =================
  421.    The names for reject files (files containing patches that `patch'
  422. could not find a place to apply) are normally the name of the output
  423. file with `.rej' appended (or `#' on systems that do not support long
  424. file names).
  425.    Alternatively, you can tell `patch' to place all of the rejected
  426. patches in a single file.  The `-r REJECT-FILE' or
  427. `--reject-file=REJECT-FILE' option uses REJECT-FILE as the reject file
  428. name.
  429. File: diff.info,  Node: patch Options,  Prev: Rejects,  Up: Invoking patch
  430. Options to `patch'
  431. ==================
  432.    Here is a summary of all of the options that `patch' accepts.  Older
  433. versions of `patch' do not accept long-named options or the `-t', `-E',
  434. or `-V' options.
  435.    Multiple single-letter options that do not take an argument can be
  436. combined into a single command line argument (with only one dash).
  437. Brackets ([ and ]) indicate that an option takes an optional argument.
  438. `-b BACKUP-SUFFIX'
  439.      Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
  440.      `~'.  *Note Backups::.
  441. `-B BACKUP-PREFIX'
  442.      Use BACKUP-PREFIX as a prefix to the backup file name.  If this
  443.      option is specified, any `-b' option is ignored.  *Note Backups::.
  444. `--batch'
  445.      Do not ask any questions.  *Note patch Messages::.
  446. `--context'
  447.      Interpret the patch file as a context diff.  *Note patch Input::.
  448. `-d DIRECTORY'
  449. `--directory=DIRECTORY'
  450.      Makes directory DIRECTORY the current directory for interpreting
  451.      both file names in the patch file, and file names given as
  452.      arguments to other options.  *Note patch Directories::.
  453. `-D NAME'
  454.      Make merged if-then-else output using FORMAT.  *Note
  455.      If-then-else::.
  456. `--debug=NUMBER'
  457.      Set internal debugging flags.  Of interest only to `patch'
  458.      patchers.
  459. `--ed'
  460.      Interpret the patch file as an `ed' script.  *Note patch Input::.
  461.      Remove output files that are empty after the patches have been
  462.      applied.  *Note Empty Files::.
  463.      Assume that the user knows exactly what he or she is doing, and do
  464.      not ask any questions.  *Note patch Messages::.
  465. `-F LINES'
  466.      Set the maximum fuzz factor to LINES.  *Note Inexact::.
  467. `--force'
  468.      Assume that the user knows exactly what he or she is doing, and do
  469.      not ask any questions.  *Note patch Messages::.
  470. `--forward'
  471.      Ignore patches that `patch' thinks are reversed or already applied.
  472.      See also `-R'.  *Note Reversed Patches::.
  473. `--fuzz=LINES'
  474.      Set the maximum fuzz factor to LINES.  *Note Inexact::.
  475. `--ifdef=NAME'
  476.      Make merged if-then-else output using FORMAT.  *Note
  477.      If-then-else::.
  478. `--ignore-whitespace'
  479.      Let any sequence of whitespace in the patch file match any
  480.      sequence of whitespace in the input file.  *Note Changed
  481.      Whitespace::.
  482. `--normal'
  483.      Interpret the patch file as a normal diff.  *Note patch Input::.
  484.      Ignore patches that `patch' thinks are reversed or already applied.
  485.      See also `-R'.  *Note Reversed Patches::.
  486. `-o OUTPUT-FILE'
  487. `--output=OUTPUT-FILE'
  488.      Use OUTPUT-FILE as the output file name.  *Note patch Options::.
  489. `-p[NUMBER]'
  490.      Set the file name strip count to NUMBER.  *Note patch
  491.      Directories::.
  492. `--prefix=BACKUP-PREFIX'
  493.      Use BACKUP-PREFIX as a prefix to the backup file name.  If this
  494.      option is specified, any `-b' option is ignored.  *Note Backups::.
  495. `--quiet'
  496.      Work silently unless an error occurs.  *Note patch Messages::.
  497. `-r REJECT-FILE'
  498.      Use REJECT-FILE as the reject file name.  *Note Rejects::.
  499.      Assume that this patch was created with the old and new files
  500.      swapped.  *Note Reversed Patches::.
  501. `--reject-file=REJECT-FILE'
  502.      Use REJECT-FILE as the reject file name.  *Note Rejects::.
  503. `--remove-empty-files'
  504.      Remove output files that are empty after the patches have been
  505.      applied.  *Note Empty Files::.
  506. `--reverse'
  507.      Assume that this patch was created with the old and new files
  508.      swapped.  *Note Reversed Patches::.
  509.      Work silently unless an error occurs.  *Note patch Messages::.
  510.      Ignore this patch from the patch file, but continue looking for
  511.      the next patch in the file.  *Note Multiple Patches::.
  512. `--silent'
  513.      Work silently unless an error occurs.  *Note patch Messages::.
  514. `--skip'
  515.      Ignore this patch from the patch file, but continue looking for
  516.      the next patch in the file.  *Note Multiple Patches::.
  517. `--strip[=NUMBER]'
  518.      Set the file name strip count to NUMBER.  *Note patch
  519.      Directories::.
  520. `--suffix=BACKUP-SUFFIX'
  521.      Use BACKUP-SUFFIX as the backup extension instead of `.orig' or
  522.      `~'.  *Note Backups::.
  523.      Do not ask any questions.  *Note patch Messages::.
  524. `--unified'
  525.      Interpret the patch file as a unified diff.  *Note patch Input::.
  526.      Output the revision header and patch level of `patch'.
  527. `-V BACKUP-STYLE'
  528.      Select the kind of backups to make.  *Note Backups::.
  529. `--version'
  530.      Output the revision header and patch level of `patch'.
  531. `--version=control=BACKUP-STYLE'
  532.      Select the kind of backups to make.  *Note Backups::.
  533. `-x NUMBER'
  534.      Set internal debugging flags.  Of interest only to `patch'
  535.      patchers.
  536. File: diff.info,  Node: Invoking sdiff,  Next: Incomplete Lines,  Prev: Invoking patch,  Up: Top
  537. Invoking `sdiff'
  538. ****************
  539.    The `sdiff' command merges two files and interactively outputs the
  540. results.  Its arguments are as follows:
  541.      sdiff -o OUTFILE OPTIONS... FROM-FILE TO-FILE
  542.    This merges FROM-FILE with TO-FILE, with output to OUTFILE.  If
  543. FROM-FILE is a directory and TO-FILE is not, `sdiff' compares the file
  544. in FROM-FILE whose file name is that of TO-FILE, and vice versa.
  545. fROM-FILE and TO-FILE may not both be directories.
  546.    `sdiff' options begin with `-', so normally FROM-FILE and TO-FILE
  547. may not begin with `-'.  However, `--' as an argument by itself treats
  548. the remaining arguments as file names even if they begin with `-'.  You
  549. may not use `-' as an input file.
  550.    An exit status of 0 means no differences were found, 1 means some
  551. differences were found, and 2 means trouble.
  552.    `sdiff' without `-o' (or `--output') produces a side-by-side
  553. difference.  This usage is obsolete; use `diff --side-by-side' instead.
  554. * Menu:
  555. * sdiff Options::    Summary of options to `diff'.
  556. File: diff.info,  Node: sdiff Options,  Up: Invoking sdiff
  557. Options to `sdiff'
  558. ==================
  559.    Below is a summary of all of the options that GNU `sdiff' accepts.
  560. Each option has two equivalent names, one of which is a single letter
  561. preceded by `-', and the other of which is a long name preceded by
  562. `--'.  Multiple single letter options (unless they take an argument)
  563. can be combined into a single command line argument.  Long named
  564. options can be abbreviated to any unique prefix of their name.
  565.      Treat all files as text and compare them line-by-line, even if they
  566.      do not appear to be text.  *Note Binary::.
  567.      Ignore changes in amount of blank and tab whitespace.  *Note
  568.      Whitespace::.
  569.      Ignore changes that just insert or delete blank lines.  *Note
  570.      Blank Lines::.
  571.      Change the algorithm to perhaps find a smaller set of changes.
  572.      This makes `sdiff' slower (sometimes much slower).  *Note diff
  573.      Performance::.
  574.      Use heuristics to speed handling of large files that have numerous
  575.      scattered small changes.  *Note diff Performance::.
  576. `--expand-tabs'
  577.      Expand tabs to spaces in the output, to preserve the alignment of
  578.      tabs in the input files.  *Note Tabs::.
  579.      Ignore changes in case; consider upper- and lower-case to be the
  580.      same.  *Note Case Folding::.
  581. `-I REGEXP'
  582.      Ignore changes that just insert or delete lines that match REGEXP.
  583.      *Note Specified Folding::.
  584. `--ignore-all-space'
  585.      Ignore whitespace when comparing lines.  *Note Whitespace::.
  586. `--ignore-blank-lines'
  587.      Ignore changes that just insert or delete blank lines.  *Note
  588.      Blank Lines::.
  589. `--ignore-case'
  590.      Ignore changes in case; consider upper- and lower-case to be the
  591.      same.  *Note Case Folding::.
  592. `--ignore-matching-lines=REGEXP'
  593.      Ignore changes that just insert or delete lines that match REGEXP.
  594.      *Note Specified Folding::.
  595. `--ignore-space-change'
  596.      Ignore changes in amount of blank and tab whitespace.  *Note
  597.      Whitespace::.
  598. `--left-column'
  599.      Print only the left column of two common lines.  *Note Side by
  600.      Side Format::.
  601. `--minimal'
  602.      Change the algorithm to perhaps find a smaller set of changes.
  603.      This makes `sdiff' slower (sometimes much slower).  *Note diff
  604.      Performance::.
  605. `-o FILE'
  606. `--output=FILE'
  607.      Put merged output into FILE.  This option is required for merging.
  608. `--suppress-common-lines'
  609.      Do not print common lines.  *Note Side by Side Format::.
  610. `--speed-large-files'
  611.      Use heuristics to speed handling of large files that have numerous
  612.      scattered small changes.  *Note diff Performance::.
  613.      Expand tabs to spaces in the output, to preserve the alignment of
  614.      tabs in the input files.  *Note Tabs::.
  615. `--text'
  616.      Treat all files as text and compare them line-by-line, even if they
  617.      do not appear to be text.  *Note Binary::.
  618. `--version'
  619.      Output the version number of `sdiff'.
  620. `-w COLUMNS'
  621. `--width=COLUMNS'
  622.      Use an output width of COLUMNS.  *Note Side by Side Format::.
  623.      Note that for historical reasons, this option is `-W' in `diff',
  624.      `-w' in `sdiff'.
  625.      Ignore horizontal whitespace when comparing lines.  *Note
  626.      Whitespace::.  Note that for historical reasons, this option is
  627.      `-w' in `diff', `-W' in `sdiff'.
  628. File: diff.info,  Node: Incomplete Lines,  Next: Projects,  Prev: Invoking sdiff,  Up: Top
  629. Incomplete Lines
  630. ****************
  631.    When an input file ends in a non-newline character, its last line is
  632. called an "incomplete line" because its last character is not a
  633. newline.  All other lines are called "full lines" and end in a newline
  634. character.  Incomplete lines do not match full lines unless differences
  635. in blank lines are ignored (*note Blank Lines::.).
  636.    An incomplete line is normally distinguished on output from a full
  637. line by a following line that starts with `\'.  However, the RCS format
  638. (*note RCS::.) outputs the incomplete line as-is, without any trailing
  639. newline or following line.  The side by side format normally represents
  640. incomplete lines as-is, but in some cases uses a `\' or `/' gutter
  641. marker; *Note Side by Side::.  The if-then-else line format preserves a
  642. line's incompleteness with `%L', and discards the newline with `%l';
  643. *Note Line Formats::.  Finally, with the `ed' and forward `ed' output
  644. formats (*note Output Formats::.) `diff' cannot represent an incomplete
  645. line, so it pretends there was a newline and reports an error.
  646.    For example, suppose `F' and `G' are one-byte files that contain
  647. just `f' and `g', respectively.  Then `diff F G' outputs
  648.      1c1
  649.      < f
  650.      \ No newline at end of file
  651.      ---
  652.      > g
  653.      \ No newline at end of file
  654. (The exact message may differ in non-English locales.) `diff -n F G'
  655. outputs the following without a trailing newline:
  656.      d1 1
  657.      a1 1
  658.      g
  659.    `diff -e F G' reports two errors and outputs the following:
  660.      1c
  661.      g
  662.      .
  663. File: diff.info,  Node: Projects,  Next: Concept Index,  Prev: Incomplete Lines,  Up: Top
  664. Future Projects
  665. ***************
  666.    Here are some ideas for improving GNU `diff' and `patch'.  The GNU
  667. project has identified some improvements as potential programming
  668. projects for volunteers.  You can also help by reporting any bugs that
  669. you find.
  670.    If you are a programmer and would like to contribute something to the
  671. GNU project, please consider volunteering for one of these projects.  If
  672. you are seriously contemplating work, please write to
  673. `gnu@prep.ai.mit.edu' to coordinate with other volunteers.
  674. * Menu:
  675. * Shortcomings::    Suggested projects for improvements.
  676. * Bugs::        Reporting bugs.
  677. File: diff.info,  Node: Shortcomings,  Next: Bugs,  Up: Projects
  678. Suggested Projects for Improving GNU `diff' and `patch'
  679. =======================================================
  680.    One should be able to use GNU `diff' to generate a patch from any
  681. pair of directory trees, and given the patch and a copy of one such
  682. tree, use `patch' to generate a faithful copy of the other.
  683. Unfortunately, some changes to directory trees cannot be expressed using
  684. current patch formats; also, `patch' does not handle some of the
  685. existing formats.  These shortcomings motivate the following suggested
  686. projects.
  687. * Menu:
  688. * Changing Structure::    Handling changes to the directory structure.
  689. * Special Files::    Handling symbolic links, device special files, etc.
  690. * Unusual File Names::    Handling file names that contain unusual characters.
  691. * Arbitrary Limits::    Patching non-text files.
  692. * Large Files::        Handling files that do not fit in memory.
  693. * Ignoring Changes::    Ignoring certain changes while showing others.
  694. File: diff.info,  Node: Changing Structure,  Next: Special Files,  Up: Shortcomings
  695. Handling Changes to the Directory Structure
  696. -------------------------------------------
  697.    `diff' and `patch' do not handle some changes to directory
  698. structure.  For example, suppose one directory tree contains a directory
  699. named `D' with some subsidiary files, and another contains a file with
  700. the same name `D'.  `diff -r' does not output enough information for
  701. `patch' to transform the the directory subtree into the file.
  702.    There should be a way to specify that a file has been deleted without
  703. having to include its entire contents in the patch file.  There should
  704. also be a way to tell `patch' that a file was renamed, even if there is
  705. no way for `diff' to generate such information.
  706.    These problems can be fixed by extending the `diff' output format to
  707. represent changes in directory structure, and extending `patch' to
  708. understand these extensions.
  709. File: diff.info,  Node: Special Files,  Next: Unusual File Names,  Prev: Changing Structure,  Up: Shortcomings
  710. Files that are Neither Directories Nor Regular Files
  711. ----------------------------------------------------
  712.    Some files are neither directories nor regular files: they are
  713. unusual files like symbolic links, device special files, named pipes,
  714. and sockets.  Currently, `diff' treats all these files like regular
  715. files.  However, this means that `patch' cannot represent changes to
  716. such files.  For example, if you change which file a symbolic link
  717. points to, `diff' outputs the difference between the two files, instead
  718. of the change to the symbolic link.
  719.    `diff' should optionally report changes to special files specially,
  720. and `patch' should be extended to understand these extensions.
  721. File: diff.info,  Node: Unusual File Names,  Next: Arbitrary Limits,  Prev: Special Files,  Up: Shortcomings
  722. File Names that Contain Unusual Characters
  723. ------------------------------------------
  724.    When a file name contains an unusual character like a newline or
  725. whitespace, `diff -r' generates a patch that `patch' cannot parse.  The
  726. problem is with format of `diff' output, not just with `patch', because
  727. with odd enough file names one can cause `diff' to generate a patch
  728. that is syntactically correct but patches the wrong files.  The format
  729. of `diff' output should be extended to handle all possible file names.
  730. File: diff.info,  Node: Arbitrary Limits,  Next: Large Files,  Prev: Unusual File Names,  Up: Shortcomings
  731. Arbitrary Limits
  732. ----------------
  733.    GNU `diff' can analyze files with arbitrarily long lines and files
  734. that end in incomplete lines.  However, `patch' cannot patch such
  735. files.  The `patch' internal limits on line lengths should be removed,
  736. and `patch' should be extended to parse `diff' reports of incomplete
  737. lines.
  738. File: diff.info,  Node: Large Files,  Next: Ignoring Changes,  Prev: Arbitrary Limits,  Up: Shortcomings
  739. Handling Files that Do Not Fit in Memory
  740. ----------------------------------------
  741.    `diff' operates by reading both files into memory.  This method
  742. fails if the files are too large, and `diff' should have a fallback.
  743.    One way to do this is to scan the files sequentially to compute hash
  744. codes of the lines and put the lines in equivalence classes based only
  745. on hash code.  Then compare the files normally.  This does produce some
  746. false matches.
  747.    Then scan the two files sequentially again, checking each match to
  748. see whether it is real.  When a match is not real, mark both the
  749. "matching" lines as changed.  Then build an edit script as usual.
  750.    The output routines would have to be changed to scan the files
  751. sequentially looking for the text to print.
  752. File: diff.info,  Node: Ignoring Changes,  Prev: Large Files,  Up: Shortcomings
  753. Ignoring Certain Changes
  754. ------------------------
  755.    It would be nice to have a feature for specifying two strings, one in
  756. FROM-FILE and one in TO-FILE, which should be considered to match.
  757. Thus, if the two strings are `foo' and `bar', then if two lines differ
  758. only in that `foo' in file 1 corresponds to `bar' in file 2, the lines
  759. are treated as identical.
  760.    It is not clear how general this feature can or should be, or what
  761. syntax should be used for it.
  762. File: diff.info,  Node: Bugs,  Prev: Shortcomings,  Up: Projects
  763. Reporting Bugs
  764. ==============
  765.    If you think you have found a bug in GNU `cmp', `diff', `diff3',
  766. `sdiff', or `patch', please report it by electronic mail to
  767. `bug-gnu-utils@prep.ai.mit.edu'.  Send as precise a description of the
  768. problem as you can, including sample input files that produce the bug,
  769. if applicable.
  770.    Because Larry Wall has not released a new version of `patch' since
  771. mid 1988 and the GNU version of `patch' has been changed since then,
  772. please send bug reports for `patch' by electronic mail to both
  773. `bug-gnu-utils@prep.ai.mit.edu' and `lwall@netlabs.com'.
  774. File: diff.info,  Node: Concept Index,  Prev: Projects,  Up: Top
  775. Concept Index
  776. *************
  777. * Menu:
  778. * cmp invocation:                       Invoking cmp.
  779. * cmp options:                          cmp Options.
  780. * diff3 hunks:                          diff3 Hunks.
  781. * diff3 invocation:                     Invoking diff3.
  782. * diff3 options:                        diff3 Options.
  783. * diff3 sample input:                   Sample diff3 Input.
  784. * diff invocation:                      Invoking diff.
  785. * diff options:                         diff Options.
  786. * diff sample input:                    Sample diff Input.
  787. * ed script output format:              ed Scripts.
  788. * ifdef output format:                  If-then-else.
  789. * patch input format:                   patch Input.
  790. * patch invocation:                     Invoking patch.
  791. * patch messages and questions:         patch Messages.
  792. * patch options:                        patch Options.
  793. * sdiff invocation:                     Invoking sdiff.
  794. * sdiff options:                        sdiff Options.
  795. * sdiff output format:                  sdiff Option Summary.
  796. * ! output format:                      Context.
  797. * +- output format:                     Unified Format.
  798. * <<<<<<< for marking conflicts:        Marking Conflicts.
  799. * < output format:                      Normal.
  800. * aligning tabstops:                    Tabs.
  801. * alternate file names:                 Alternate Names.
  802. * backup file names:                    Backups.
  803. * binary file diff:                     Binary.
  804. * binary file patching:                 Arbitrary Limits.
  805. * blank and tab difference suppression: Whitespace.
  806. * blank line difference suppression:    Blank Lines.
  807. * brief difference reports:             Brief.
  808. * bug reports:                          Bugs.
  809. * C function headings:                  C Function Headings.
  810. * C if-then-else output format:         If-then-else.
  811. * case difference suppression:          Case Folding.
  812. * columnar output:                      Side by Side.
  813. * comparing three files:                Comparing Three Files.
  814. * conflict:                             diff3 Merging.
  815. * conflict marking:                     Marking Conflicts.
  816. * context output format:                Context.
  817. * diagnostics from patch:               patch Messages.
  818. * diff merging:                         Interactive Merging.
  819. * directories and patch:                patch Directories.
  820. * directory structure shanges:          Changing Structure.
  821. * empty files, removing:                Empty Files.
  822. * file name alternates:                 Alternate Names.
  823. * file names with unusual characters:   Unusual File Names.
  824. * format of diff3 output:               Comparing Three Files.
  825. * format of diff output:                Output Formats.
  826. * formats for if-then-else line groups: Line Group Formats.
  827. * forward ed script output format:      Forward ed.
  828. * full lines:                           Incomplete Lines.
  829. * function headings, C:                 C Function Headings.
  830. * fuzz factor when patching:            Inexact.
  831. * headings:                             Sections.
  832. * hunks:                                Hunks.
  833. * hunks for diff3:                      diff3 Hunks.
  834. * if-then-else output format:           If-then-else.
  835. * imperfect patch application:          Imperfect.
  836. * incomplete line merging:              Merging Incomplete Lines.
  837. * incomplete lines:                     Incomplete Lines.
  838. * inexact patches:                      Inexact.
  839. * interactive merging:                  Interactive Merging.
  840. * introduction:                         Comparison.
  841. * invoking cmp:                         Invoking cmp.
  842. * invoking diff3:                       Invoking diff3.
  843. * invoking diff:                        Invoking diff.
  844. * invoking patch:                       Invoking patch.
  845. * invoking sdiff:                       Invoking sdiff.
  846. * large files:                          Large Files.
  847. * line formats:                         Line Formats.
  848. * line group formats:                   Line Group Formats.
  849. * merge commands:                       Merge Commands.
  850. * merged diff3 format:                  Bypassing ed.
  851. * merged output format:                 If-then-else.
  852. * merging from a common ancestor:       diff3 Merging.
  853. * merging interactively:                Merge Commands.
  854. * messages from patch:                  patch Messages.
  855. * multiple patches:                     Multiple Patches.
  856. * newline treatment by diff:            Incomplete Lines.
  857. * normal output format:                 Normal.
  858. * options for cmp:                      cmp Options.
  859. * options for diff3:                    diff3 Options.
  860. * options for diff:                     diff Options.
  861. * options for patch:                    patch Options.
  862. * options for sdiff:                    sdiff Options.
  863. * output formats:                       Output Formats.
  864. * overlap:                              diff3 Merging.
  865. * overlapping change, selection of:     Which Changes.
  866. * overview of diff and patch:           Overview.
  867. * paginating diff output:               Pagination.
  868. * patch making tips:                    Making Patches.
  869. * patching directories:                 patch Directories.
  870. * performance of diff:                  diff Performance.
  871. * projects for directories:             Shortcomings.
  872. * RCS script output format:             RCS.
  873. * regular expression matching headings: Specified Headings.
  874. * regular expression suppression:       Specified Folding.
  875. * reject file names:                    Rejects.
  876. * removing empty files:                 Empty Files.
  877. * reporting bugs:                       Bugs.
  878. * reversed patches:                     Reversed Patches.
  879. * sample input for diff3:               Sample diff3 Input.
  880. * sample input for diff:                Sample diff Input.
  881. * script output formats:                Scripts.
  882. * section headings:                     Sections.
  883. * side by side:                         Side by Side.
  884. * side by side format:                  Side by Side Format.
  885. * special files:                        Special Files.
  886. * specified headings:                   Specified Headings.
  887. * summarizing which files differ:       Brief.
  888. * System V diff3 compatibility:         Saving the Changed File.
  889. * tab and blank difference suppression: Whitespace.
  890. * tabstop alignment:                    Tabs.
  891. * text versus binary diff:              Binary.
  892. * tips for patch making:                Making Patches.
  893. * two-column output:                    Side by Side.
  894. * unified output format:                Unified Format.
  895. * unmerged change:                      Which Changes.
  896. * whitespace in patches:                Changed Whitespace.
  897.